<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class LoginPostRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'user_name' => 'bail|required|exists:user,user_name',
            'password' => 'required',
        ];
    }

    /**
     * @Author   tianyu
     * @DateTime 2017-04-06T17:58:40+0800
     * @return   array
     */
    public function messages()
    {
        return [
            'user_name.required' => '用户名不能为空',
            'user_name.exists' => '该用户名不存在',
            'password.required'  => '密码不能为空',
        ];
    }
}
